load("@fbcode_macros//build_defs:cpp_library.bzl", "cpp_library")
load("@fbsource//tools/build_defs:rust_library.bzl", "rust_library")

oncall("mononoke")

cpp_library(
    name = "lib",
    srcs = [
        "src/ffi.cpp",
    ],
    headers = [
        "src/ffi.h",
    ],
    undefined_symbols = True,
    deps = [],
    exported_deps = [
        "//eden/mononoke/adaptive_rate_limiter/cpp:adaptive_rate_limiter_cpp",
    ],
)

rust_library(
    name = "adaptive_rate_limiter",
    srcs = [
        "src/ffi.rs",
        "src/lib.rs",
    ],
    allow_oss_build = False,
    autocargo = {"ignore_rule": True},
    cpp_deps = [":lib"],
    cxx_bridge = "src/ffi.rs",
    test_deps = [
        "//eden/mononoke/mononoke_macros:mononoke_macros",
    ],
    deps = [
        "fbsource//third-party/rust:cxx",
        "//common/rust/shed/stats:stats",
    ],
)
